home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5093 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: hilbert.dnai.com!usenet
  2. From: Victor Bazarov <vbazarov@imsisoft.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: (void(far *)()) 0
  5. Date: Wed, 07 Feb 1996 11:05:55 -0800
  6. Organization: IMSI
  7. Message-ID: <3118F813.41BF@imsisoft.com>
  8. References: <341998718.10858110@magnet.at> <31165B9D.398E@imsisoft.com> <4f66c0$cn0@solutions.solon.com>
  9. NNTP-Posting-Host: 204.182.61.84
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (Win95; I)
  14.  
  15. Peter Seebach wrote:
  16. > In article <31165B9D.398E@imsisoft.com>,
  17. > Victor Bazarov  <vbazarov@imsisoft.com> wrote:
  18. > >> .... = (void(far *)()) 0;
  19. > >> Now I want to know if my assumption is right and
  20. > >> in case it is, what does this mean for 0 ?
  21. > >Nothing but what you've said -- cast. '0' has type 'int',
  22. > >and must be converted into pointer to function in order
  23. > >to be properly assigned.
  24. > Not exactly.
  25. > 0 is a special case.  Zero cast to a pointer type is a null pointer of that
  26. > type.  Or rather, *a constant zero* is.  An integer with value zero may
  27. > produce different results.
  28.  
  29. As I undestood, this "may produce different results":
  30.  
  31. typedef void (far *pVOIDVOID)();
  32. int zero = 0;
  33. pVOIDVOID funky;
  34. funky = (void(far *)()) zero;
  35.  
  36. than
  37.  
  38. typedef void (far *pVOIDVOID)();
  39. pVOIDVOID funky;
  40. funky = (void(far *)()) 0;
  41.  
  42. ?
  43.  
  44. > A textual zero, cast to pointer type, points at no object; this is magic.
  45. > Before you try to correct or clarify this, *make sure you have read the
  46. > C FAQ and understand the relevant points.*
  47.